class Product:
    def __init__(self, name, price):
        self.name = name
        self.price = price

class CartItem:
    def __init__(self, product, qty):
        self.product = product
        self.qty = qty
    def subtotal(self):
        return self.product.price * self.qty

class ShoppingCart:
    def __init__(self):
        self.items = []
    def add(self, product, qty=1):
        self.items.append(CartItem(product, qty))
    def total(self):
        return sum(item.subtotal() for item in self.items)
    def show(self):
        print("-"*30)
        for item in self.items:
            print(f"{item.product.name} ×{item.qty}\t￥{item.subtotal():.2f}")
        print("-"*30)
        print(f"应付总额：￥{self.total():.2f}")

# --- 测试 ---
apple = Product("苹果", 5)
bread = Product("面包", 4.0)
cart = ShoppingCart()
cart.add(apple, 4)
cart.add(bread, 2)
cart.show()